home *** CD-ROM | disk | FTP | other *** search
- Path: access4.digex.net!not-for-mail
- From: ell@access4.digex.net (Ell)
- Newsgroups: comp.object,comp.lang.c++
- Subject: Re: A design question
- Date: 27 Feb 1996 14:07:32 GMT
- Organization: The Universe
- Message-ID: <4gv374$g54@news4.digex.net>
- References: <1996Feb22.234825.18755@dcs.warwick.ac.uk> <4gu4br$bmc@news4.digex.net>
- NNTP-Posting-Host: access4.digex.net
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Ell (ell@access1.digex.net) wrote:
- : Robert Marrtin writes:
- : : class ParcelState
- : : {
- : : public:
- : : // the events that occur along the processing chain.
- : : virtual void Event1(MyParcel&) = 0;
- : : virtual void Event2(MyParcel&) = 0;
- : : };
- : :
- : : // This is the parcel itself. It also defines functions which respond
- : : // to all its events. However, these functions simply delegate to the
- : : // contained state object.
- : :
- : : class MyParcel
- : : {
- : : public:
- : : MyParcel();
- : : void Event1() {itsState->Event1(*this);}
- : : void Event2() {itsState->Event2(*this);}
- : : private:
- : : ParcelState* itsState;
- : : };
-
- : I'm wondering if the above class MyParcel shouldn't publicly inherit from
- : ParcelState?
-
- I see now, that no you don't want such inheritance. You want to call the
- methods of the children of ParcelState in MyParcel's methods.
-
- Elliott
-